package easy.id_0_100;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;

public class hua1 {

    public static void main(String[] args) {
        String[] a1={"00001001","00ABCD00"};
        String[] a2={"FFFFFAAB","FFFFFAAB","00ABCD00"};

        String[] re=getAllFault(a1, a2);
        for(String str:re){
            System.out.println(str);
        }

        System.out.println(re);

    }


    private static String[] getAllFault(String[] arrayA, String[] arrayB) {
        Set<String> setA=new HashSet<>();
        for(int i=0;i<arrayA.length;i++){
            setA.add(arrayA[i]);
        }
        for(int i=0;i<arrayB.length;i++){
            setA.add(arrayB[i]);
        }
        String[] result = setA.toArray(new String[0]);
        // 使用自定义比较器进行排序
        Arrays.sort(result, new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                return s1.compareTo(s2); // 直接比较两个十六进制字符串
            }
        });
        return result;
    }

}
